import java.lang.InterruptedException;
import java.awt.event.MouseEvent;

public class Human implements IPlayer
{
    private boolean played;
    private int pos;

    public Human()
    {
    }

    public int play()
    {
    	played = false;
    	do
	    {
    		try
		    {	
    			Thread.currentThread();
    			Thread.sleep(200);
		    }
    		catch(InterruptedException ie){}
	    }
    	while(played == false);
    	return pos;
    }

    // MouseListener
    public void mouseClicked(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e)
    {
	if(played == false)
	    {
		int x = e.getX();
		for(int i=0; i<P4.WIDTH; i++)
		    {
			if(x >= i*GridFrame.BLOCS && x < i*GridFrame.BLOCS+GridFrame.BLOCS)
			    pos = i;
		    }
		played = true;
	    }
    }
}